public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        System.out.println("前序遍历二叉树");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.println("中序遍历：");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.println("后序遍历：");
        binaryTree.postOrder(root);
        System.out.println();

        System.out.println("该二叉树节点数：");
        binaryTree.getNodeSize1(root);
        System.out.println(binaryTree.nodeSize);
        int ret = binaryTree.getNodeSize2(root);
        System.out.println(ret);

        System.out.println("该二叉树叶子节点数：");
        binaryTree.getLeafNodeCount(root);
        System.out.println(binaryTree.leafNodeCount);
        System.out.println(binaryTree.getLeafNodeCount2(root));

        System.out.println("获取该二叉树第K层节点：");
        System.out.println(binaryTree.getKLevelNodeCount(root,2));
        System.out.println(binaryTree.getKLevelNodeCount(root,3));

        System.out.println("获取该二叉树的高度：");
        System.out.println(binaryTree.getHeight(root));

        System.out.println("检测值为value的元素是否存在于二叉树中：");
        BinaryTree.TreeNode ret2 = binaryTree.find(root,'E');
        if(ret2 == null){
            System.out.println("    不存在");
        }else{
            System.out.println(ret2.val);
        }

        System.out.println("判断两二叉树是否相同：");
        System.out.println(binaryTree.isSameTree(root,root.left));
        System.out.println(binaryTree.isSameTree(root,root));

        System.out.println("层序遍历二叉树:");
        binaryTree.levelOrder(root);
        System.out.println();

        System.out.println("判断该二叉树是否是一颗完全二叉树:");
        System.out.println("    " + binaryTree.isCompleteTree(root.right));
        if(binaryTree.isCompleteTree(root.right)){
            System.out.println("    是完全二叉树");
        }else{
            System.out.println("    不是");
        }

        System.out.println("判断该二叉树是否是平衡二叉树：");
        if(binaryTree.isBalanced(root)){
            System.out.println("    是");
        }else{
            System.out.println("    不是");
        }
    }
}
